/**
 * 指定元素下创建 canvans
 * @param el 选择器或者元素
 * @param id canvas的id属性
 * @param width canvas的width属性
 * @param height canvas的height
 * @returns HTMLCanvasElement 对象
 */
export const createCanvas = (el: string | HTMLElement, id: string, width: number, height: number) => {
    const canvas = document.createElement('canvas')
    canvas.id = id
    canvas.width = width
    canvas.height = height
    if (typeof el === 'string') {
        document.querySelector<HTMLElement>(el)?.appendChild(canvas)
    } else {
        el.appendChild(canvas)
    }
    return canvas
}
